using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SceneEngine;
using System.Windows.Forms;

namespace SceneEditor
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        public GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        Editor editor;

        Form gameWindow;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this)
            {
                PreferMultiSampling = true
            };

            Content.RootDirectory = "Content";

            EngineGlobals.Content = this.Content;

            editor = new Editor(this);

            graphics.PreferredBackBufferWidth = 1425;
            graphics.PreferredBackBufferHeight = 903;

            graphics.ApplyChanges();

            Components.Add(editor);
        }

        void EditorForm_VisibleChanged(object sender, EventArgs e)
        {
            gameWindow.Visible = editor.EditorForm.Visible;
        }

        protected override void Initialize()
        {

            base.Initialize();

            //editor.EditorForm.VisibleChanged += new EventHandler(EditorForm_VisibleChanged);

            gameWindow = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle((this.Window.Handle));
            gameWindow.ShowInTaskbar = false;
            gameWindow.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            gameWindow.Opacity = 0;
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

        }

        protected override void Update(GameTime gameTime)
        {

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            base.Draw(gameTime);
        }
    }
}
